﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================

using XCI.Config;

namespace XCI.Mail
{
    /// <summary>
    /// 邮件设置
    /// </summary>
    public class MailSetting
    {
        private int _port = 25;
        private int _timeout = 10000;
        private static MailSetting _instance;

        /// <summary>
        /// 配置对象
        /// </summary>
        public static MailSetting Default
        {
            get { return _instance ?? (_instance = ConfigFactory.Default.Get<MailSetting>("Email", () => new MailSetting())); }
        }

        /// <summary>
        /// 是否启用电子邮件发送
        /// </summary>
        public bool EnableEmail { get; set; }

        /// <summary>
        /// 获取或设置SMTP服务器
        /// </summary>
        public string SmtpServer { get; set; }

        /// <summary>
        /// 发送者地址
        /// </summary>
        public string From { get; set; }

        /// <summary>
        /// 获取或设置授权用户名
        /// </summary>
        public string AuthenticationUserName { get; set; }

        /// <summary>
        /// 获取或设置授权用户密码
        /// </summary>
        public string AuthenticationPassword { get; set; }

        /// <summary>
        /// 获取或设置是否需要授权验证
        /// </summary>
        public bool IsAuthenticationRequired { get; set; }

        /// <summary>
        /// 是否使用安全套接字层 (SSL) 加密连接
        /// </summary>
        public bool EnableSsl { get; set; }

        /// <summary>
        /// 端口号 默认25
        /// </summary>
        public int Port
        {
            get { return _port; }
            set { _port = value; }
        }

        /// <summary>
        /// 发送超时时间以毫秒为单位,默认值为10 秒
        /// </summary>
        public int Timeout
        {
            get { return _timeout; }
            set { _timeout = value; }
        }
    }
}